package com.city.ajax;


import com.city.config.Code;
import com.city.service.report.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @deprecation 主页请求接口
 * @email leichuqiao@126.com
 * @author 雷楚桥
 * @date 2018-09-12 16:24
 */
@RestController
@RequestMapping("/ajax/home")
public class HomeAjax {

    @Autowired
    private MessageService messageS;

    /**
     * @deprecation 消息反馈
     * @param id Integer 消息id
     * @param msg String 反馈信息
     * @return Map
     * @author 雷楚桥
     * @date 2018-09-12 16:24
     */
    @ResponseBody
    @RequestMapping("/msgBack")
    public Map<String,Object> msgBack(@Param("id") Integer id,
                                      @Param("msg") String msg,
                                      @Param("taskId") Integer taskId){
        Map<String,Object> map = new HashMap<>();
        Map<String,Object> data = new HashMap<>();

        System.out.println(taskId);
        data.put("message",messageS.backMsg(id,msg,taskId));

        map.put("code", Code.SUCCESS);
        map.put("msg", "请求成功");
        map.put("data", data);
        return map;
    }
}
